<template>
  <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title" width="700px">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="120px">
      <el-form-item label="用户ID">
        <el-input v-model="form.userId" />
      </el-form-item>
      <el-form-item label="Token" prop="token">
        <el-input v-model="form.token" />
      </el-form-item>
      <el-form-item label="token生效时间">
        <el-date-picker v-model="form.tokenStartTime" type="datetime" />
      </el-form-item>
      <el-form-item label="token失效时间">
        <el-date-picker v-model="form.tokenEndTime" type="datetime" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="text" @click="crud.cancelCU">取消</el-button>
      <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { form } from '@crud/crud'

const defaultForm = { userId: null, token: null, tokenStartTime: null, tokenEndTime: null }
export default {
  mixins: [form(defaultForm)],
  data() {
    return {
      rules: {
        token: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }]
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
